package xx.thread.base;

public class ThreadGetRes extends Thread {
    private int count = 5;

    private String name;

    public ThreadGetRes(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println(name + "运行  count= " + count--);
            try {
                sleep((int) Math.random() * 10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        ThreadGetRes t1 = new ThreadGetRes("A");
        ThreadGetRes t2 = new ThreadGetRes("B");
        ThreadGetRes t3 = new ThreadGetRes("C");
        t1.start();
        t2.start();
        t3.start();
    }
}
